package io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class OosDemo {
    public static void main(String[] args) {
        String name = "卡迪夫";
        int age = 20;
        String tenger = "男";
        String [] otherIfo = {"官方的","广泛的","的撒旦","阿斯顿"};
        Person pn = new Person(name,age,tenger,otherIfo);

        try(
            FileOutputStream fos = new FileOutputStream("person.obj");
            ObjectOutputStream oos = new ObjectOutputStream(fos)
        ) {
            oos.writeObject(pn);
            System.out.println("写入完毕");
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
